home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / MSN Messen213866192001.psc / MSNProtocol.bas < prev   
Encoding:
BASIC Source File  |  2001-06-10  |  2.3 KB  |  104 lines

  1. Attribute VB_Name = "MSNProtocol"
  2. Const IMSPROT = "MSNP2" 'Protocole d'Θchange avec le serveur
  3. Const SECURITYPCK = "MD5" 'Protocole cryptographie
  4. Const DSIP = "messenger.hotmail.com" 'Serveur principal
  5. Const PORT = 1863 'Port pour se connecter
  6.  
  7. Const DS_TRID = 1
  8.  
  9. Const cmdXFR = "XFR"
  10.  
  11. Const ChrCode = "├í├á├ó├ñ├⌐├¿├¬├½├¡├¼├«├»├│├▓├┤├╢├║├╣├╗├╝"
  12. Const ChrNorm = "ßαΓΣΘΦΩδφ∞ε∩≤≥⌠÷·∙√ⁿ"
  13. Const cOffline = 0
  14. Const cConnected = 1
  15. Const cVer = 2
  16. Const cInf = 3
  17. Const cUsr = 4
  18. Const cHash = 5
  19.  
  20.  
  21.  
  22. Public Function Split(ByVal aText As String, OutputStr() As String, ByVal Delimiter As String) As Integer
  23.     Dim pos As Integer, lastpos As Integer
  24.     Dim argCounter As Integer, originalTxt As String
  25.     originalstr = aText
  26.     lastpos = 1
  27.  
  28.  
  29.     If InStr(1, aText, Delimiter) = 0 Then
  30.         ReDim OutputStr(1) As String
  31.         OutputStr(1) = aText
  32.         Split = 1
  33.         Exit Function
  34.     End If
  35.  
  36.  
  37.     Do
  38.         pos = InStr(1, aText, Delimiter)
  39.         argCounter = argCounter + 1
  40.         ReDim Preserve OutputStr(argCounter) As String
  41.  
  42.  
  43.         If pos = 0 Then
  44.             OutputStr(argCounter) = aText
  45.             Exit Do
  46.         End If
  47.         OutputStr(argCounter) = Left(aText, pos - 1)
  48.         aText = Mid(aText, pos + Len(Delimiter))
  49.         lastpos = 1 ' Len(originalstr) - Len(Text)
  50.     Loop
  51.     Split = argCounter
  52. End Function
  53.  
  54. Function Clean(tOrig As String) As String
  55.  
  56. 'Espaces
  57. Clean = Remplacer(tOrig, "%20", " ")
  58.  
  59. For n = 1 To Len(ChrNorm)
  60.     Clean = Remplacer(tOrig, Mid(ChrCode, (2 * n) - 1, 2), Mid(ChrNorm, n, 1))
  61. Next n
  62.  
  63. Clean = tOrig
  64. End Function
  65. Function DeClean(tOrig As String, cSpc As Boolean) As String
  66.  
  67. Dim n As Integer
  68.  
  69. If cSpc = True Then
  70.     DeClean = Remplacer(tOrig, " ", "%20")
  71. End If
  72.  
  73. For n = 1 To Len(ChrNorm)
  74.     DeClean = Remplacer(tOrig, Mid(ChrNorm, n, 1), Mid(ChrCode, (2 * n) - 1, 2))
  75. Next n
  76.  
  77. End Function
  78.  
  79. Public Function Remplacer(sData As String, sSubstring As String, sNewsubstring) As String
  80.  
  81. Dim i As String
  82. Dim lSub As Long
  83. Dim lData As Long
  84. i = 1
  85.  
  86. lSub = Len(sSubstring)
  87. lData = Len(sData)
  88.  
  89. Do
  90. i = InStr(i, sData, sSubstring)
  91. If i = 0 Then
  92.     Remplacer = sData
  93.     Exit Function
  94. Else
  95.     sData = Mid(sData, 1, i - 1) & sNewsubstring & Mid(sData, i + lSub, lData)
  96.     'i = i + lSub
  97. End If
  98. Loop Until i > Len(sData) 'lData
  99. Remplacer = sData
  100. End Function
  101.  
  102.  
  103.  
  104.